package com.example.myapplication

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import android.util.Log
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.example.myapplication.geofence.GeofenceJobIntentService
import com.example.myapplication.geofence.GeofenceLocationService

/**
 * Author: Jaydenyan
 * Date: 2022/5/20 11:27
 * Description:
 * History:
 * <author> <time> <version> <desc>
 * Jaydenyan 2022/5/20 1.0 首次创建
 * 可进行地理围栏恢复操作
 */
class BootCompleteBroadcastReceiver : BroadcastReceiver() {
    private val TAG = BootCompleteBroadcastReceiver::class.java.simpleName

    override fun onReceive(context: Context?, intent: Intent?) {
        Toast.makeText(context, "get BootCompleteBroadcastReceiver", Toast.LENGTH_SHORT).show()
        Log.e(TAG, " get BootCompleteBroadcastReceiver")
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//            context?.startForegroundService(
//                Intent(context, GeofenceLocationService::class.java)
//            )
//        } else {
//            context?.startService(
//                Intent(context, GeofenceLocationService::class.java)
//            )
//        }
    }
}